package com.itheima.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Slf4j
@Component
//@Aspect


public class MyAspect2 {
    //    @Pointcut("execution(* com.itheima.Controller.DeptController.list(..))")
//    @Pointcut("execution(* com.itheima.service.*.insert(..))")
//    @Pointcut("execution(* com.itheima.service.*.insert(..))||" +
//            "execution(* com.itheima.service.*.update(..))")


    private void pt() {
    }


    //环绕通知
//    @Around("pt()")
//    自定义通知的方法
    @Around("@annotation(com.itheima.anno.LogOperation)")
    public Object around(ProceedingJoinPoint pjd) throws Throwable {
        log.info("around...before");
        Object proceed = pjd.proceed();
        log.info("around...after");
        return proceed;
    }

}
